%\documentclass{article}
%\usepackage{tikz}
%
%\begin{document}\pagestyle{empty}
%
%\begin{figure}
\documentclass{article}
 
\usepackage[pdftex,active,tightpage]{preview}
\usepackage{tikz}
\usetikzlibrary{snakes}
\usetikzlibrary{arrows}
\makeatletter
 
\begin{document}
\begin{preview}
	%%
	\begin{tikzpicture}[scale=0.9]
	
	\draw[very thin,color=gray] (-0.1,-0.1) grid (13,4.5);
	\draw[->] (-0.2,0) -- (13.2,0) node[right] {$p$};
	\draw[->] (0,-0.2) -- (0,4.6) node[above] {seconds};
	
	\foreach \pos/\label in {0.5/1,1.5/2,2.5/4,3.5/8,4.5/16,5.5/32,6.5/64,7.5/128,8.5/256,9.5/512,10.5/1024,11.5/2048,12.5/4096}
	\draw (\pos,0) -- (\pos,-0.1) (\pos cm,-2.5ex) node [anchor=base,fill=white,inner sep=1pt]  {\scriptsize \label};
	
	\draw[very thin,color=gray, xstep=1, ystep=0.5] (0, -4.5) grid (13,-0.5);
	\draw[fill=blue!50, fill opacity=0.5] (-3,-1.0) rectangle +(3,0.5);
	\draw (-1.5, -0.75) node {\scriptsize Octree Construction};
	
	\draw[fill=red!50, fill opacity=0.5] (-3,-1.5) rectangle +(3,0.5);
	\draw (-1.5, -1.25) node {\scriptsize Octree Balancing};
	
	\draw[fill=green!50, fill opacity=0.5] (-3,-2.0) rectangle +(3,0.5);
	\draw (-1.5, -1.75) node {\scriptsize Meshing };
	
	\draw[fill=orange!50, fill opacity=0.5] (-3,-2.5) rectangle +(3,0.5);
	\draw (-1.5, -2.25) node {\scriptsize \texttt{MatVec} (5)};
	
	\draw (-3,-3.0) rectangle +(3,0.5);
	\draw (-1.5, -2.75) node {\scriptsize Points};
	
	\draw (-3,-3.5) rectangle +(3,0.5);
	\draw (-1.5, -3.25) node {\scriptsize Unbalanced Octants};
	
	\draw (-3,-4.0) rectangle +(3,0.5);
	\draw (-1.5, -3.75) node {\scriptsize Balanced Octants};
	
	\draw (-3,-4.5) rectangle +(3,0.5);
	\draw (-1.5, -4.25) node {\scriptsize Independent Vertices};
	
	\draw (-2.5ex, 0 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 0};
	
	\draw (-2.5ex, 1 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 25};
	
	\draw (-2.5ex, 2 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 50};
	
	\draw (-2.5ex, 3 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 75};
	
	\draw (-2.5ex, 4 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 100};
	
	\newdimen\mypos
	\newdimen\myoff
	
	\foreach \pos/\vala/\valb/\valc/\vald in { 0/0.99/5.34/16.01/18.61, 1/1.41/8.39/23.57/20.72, 2/1.32/8.75/23.19/21.09, 3/1.40/10.55/25.15/20.59, 4/1.44/11.94/26.77/23.29, 5/1.60/12.57/28.99/27.79, 6/1.51/13.52/27.03/25.78, 7/1.65/13.62/29.52/27.65, 8/1.72/14.67/34.91/33.01, 9/1.75/15.99/35.56/31.12, 10/2.17/18.53/36.63/32.40, 11/2.92/25.42/38.23/33.24, 12/6.68/34.44/41.14/28.27} { 
	\mypos=\pos cm
	\advance \mypos by 0.5 cm
	\draw (\mypos, -0.75 cm) node {\scriptsize \vala};
	\draw (\mypos, -1.25 cm) node {\scriptsize \valb};
	\draw (\mypos, -1.75 cm) node {\scriptsize \valc};
	\draw (\mypos, -2.25 cm) node {\scriptsize \vald};
	
	\myoff=0 cm
	
	\advance \mypos by -0.25 cm
	\draw[fill=blue!50, fill opacity=0.5, yscale=0.03980718485307666] (\mypos,\myoff) rectangle +(0.5,\vala);
	\advance \myoff by \vala cm
	\draw[fill=red!50, fill opacity=0.5, yscale=0.03980718485307666] (\mypos,\myoff) rectangle +(0.5,\valb);
	\advance \myoff by \valb cm
	\draw[fill=green!50, fill opacity=0.5, yscale=0.03980718485307666] (\mypos,\myoff) rectangle +(0.5,\valc);
	\advance \myoff by \valc cm
	\draw[fill=orange!50, fill opacity=0.5, yscale=0.03980718485307666] (\mypos,\myoff) rectangle +(0.5,\vald);
	\advance \myoff by \vald cm
	
	}
	
	\draw (0.5, -2.75) node {\scriptsize 180K};
	\draw (0.5, -3.25) node {\scriptsize 607K};
	\draw (0.5, -3.75) node {\scriptsize 996K};
	\draw (0.5, -4.25) node {\scriptsize 660K};
	\draw (1.5, -2.75) node {\scriptsize 361K};
	\draw (1.5, -3.25) node {\scriptsize 1.2M};
	\draw (1.5, -3.75) node {\scriptsize 2M};
	\draw (1.5, -4.25) node {\scriptsize 1.3M};
	\draw (2.5, -2.75) node {\scriptsize 720K};
	\draw (2.5, -3.25) node {\scriptsize 2.4M};
	\draw (2.5, -3.75) node {\scriptsize 4M};
	\draw (2.5, -4.25) node {\scriptsize 2.7M};
	\draw (3.5, -2.75) node {\scriptsize 1.47M};
	\draw (3.5, -3.25) node {\scriptsize 4.9M};
	\draw (3.5, -3.75) node {\scriptsize 8M};
	\draw (3.5, -4.25) node {\scriptsize 5.2M};
	\draw (4.5, -2.75) node {\scriptsize 2.89M};
	\draw (4.5, -3.25) node {\scriptsize 9.7M};
	\draw (4.5, -3.75) node {\scriptsize 16M};
	\draw (4.5, -4.25) node {\scriptsize 10.5M};
	\draw (5.5, -2.75) node {\scriptsize 5.8M};
	\draw (5.5, -3.25) node {\scriptsize 19.6M};
	\draw (5.5, -3.75) node {\scriptsize 31.9M};
	\draw (5.5, -4.25) node {\scriptsize 21.5M};
	\draw (6.5, -2.75) node {\scriptsize 11.7M};
	\draw (6.5, -3.25) node {\scriptsize 39.3M};
	\draw (6.5, -3.75) node {\scriptsize 64.4M};
	\draw (6.5, -4.25) node {\scriptsize 42M};
	\draw (7.5, -2.75) node {\scriptsize 23.5M};
	\draw (7.5, -3.25) node {\scriptsize 79.3M};
	\draw (7.5, -3.75) node {\scriptsize 131M};
	\draw (7.5, -4.25) node {\scriptsize 87.8M};
	\draw (8.5, -2.75) node {\scriptsize 47M};
	\draw (8.5, -3.25) node {\scriptsize 158M};
	\draw (8.5, -3.75) node {\scriptsize 257M};
	\draw (8.5, -4.25) node {\scriptsize 172M};
	\draw (9.5, -2.75) node {\scriptsize 94M};
	\draw (9.5, -3.25) node {\scriptsize 315M};
	\draw (9.5, -3.75) node {\scriptsize 519M};
	\draw (9.5, -4.25) node {\scriptsize 339M};
	\draw (10.5, -2.75) node {\scriptsize 188M};
	\draw (10.5, -3.25) node {\scriptsize 635M};
	\draw (10.5, -3.75) node {\scriptsize 1.04B};
	\draw (10.5, -4.25) node {\scriptsize 702M};
	\draw (11.5, -2.75) node {\scriptsize 376M};
	\draw (11.5, -3.25) node {\scriptsize 1.26B};
	\draw (11.5, -3.75) node {\scriptsize 2.05B};
	\draw (11.5, -4.25) node {\scriptsize 1.36B};
	\draw (12.5, -2.75) node {\scriptsize 752M};
	\draw (12.5, -3.25) node {\scriptsize 2.52B};
	\draw (12.5, -3.75) node {\scriptsize 4.16B};
	\draw (12.5, -4.25) node {\scriptsize 2.72B};
	\end{tikzpicture}%%
\end{preview}
\end{document}
%\end{figure}
%
%\end{document}
